<template>
    <div class="good">
        <div class="good-container">
            <slider :content='sliderImgs'></slider>
            <div class="current-season" v-for="(item,index) in realData" :key="index">
                <star-title :content='item.name'></star-title>
                <div class="current-season-list">
                    <double-goods :content='item.goods'></double-goods>
                </div>
            </div>
            <nothing></nothing>
        </div>
    </div>
</template>

<script>
import virtualData from './virtual'
import slider from '../../public/slider'
import starTitle from '../../public/starTitle'
import doubleGoods from '../../public/doubleGoods'
import nothing from '../../public/nothing'

export default {
    name:'good',
    data(){
        return {
            virtual:virtualData,
            titleList:['当季热销'],
            sliderImgs:[],
            realData:[]
        }
    },
    methods:{
        getSliders(){
            let that = this;
            let token = localStorage.getItem('token');
            that.$ajax(that, 'get', that.$api.mainSliders+2, null, token, function(res){
                // console.log(res);
                if(res.data['error_code'] == 0){
                    that.sliderImgs = res.data['msg'];
                    that.transferUrl(that.sliderImgs);
                }
            })
        },
        getGoodsList(){
            let that = this;
            let token = localStorage.getItem('token');
            that.$ajax(that, 'get', that.$api.homeFive+2, null, token, function(res){
                if(res.data['error_code'] == 0){
                    that.realData = res.data['msg'];
                    console.log(that.realData);
                }
            })
        }
    },
    mounted(){
        this.getSliders();
        this.getGoodsList();
    },
    components:{
        slider,
        starTitle,
        doubleGoods,
        nothing
    }
}
</script>

<style lang='less'>
@rem:100rem;

.good{
    width: 100%;
    margin-bottom: 96/@rem;
    background: #fff;
}
</style>
